<template>
    <div>
        <van-nav-bar title="会员登入" left-arrow @click-left="onClickLeft" />
    </div>
    <div style=" height: 120px; margin-top: 50px; margin-left: 37%;">
        <van-image round width="10rem" height="10rem" src="https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg" />
    </div>
    <div style="margin-top: 30px;">
        <van-form @submit="onSubmit">
            <van-cell-group inset>
                <van-field v-model="DengRuDAta" name="username" label="账号" placeholder="请输入账号"
                    :rules="[{ required: true, message: '请填写用户名' }]" />
                <van-field v-model="DengRuDAta" type="password" name="password" label="密码" placeholder="请输入密码"
                    :rules="[{ required: true, message: '请填写密码' }]" />
            </van-cell-group>
            <div style="margin: 16px; margin-top: 30px; ">
                <van-button round block type="primary" native-type="submit"
                    style="border-radius: 5px; background-color: red; border: none;font-size: 20px;">
                    登入
                </van-button>
            </div>
            <div style="width: 100%;">
                <p style="text-align: center; color: darkgray;" @click="() => { $router.push('/register') }">免费注册</p>
            </div>
        </van-form>
    </div>
</template>

<script setup>
import { ref } from 'vue';
import { useRouter } from 'vue-router';
const router=useRouter()

const username = ref('');
const password = ref('');
const onSubmit = (values) => {
    console.log('submit', values);
};
import {loginApi} from '@/api/api';
const DengRuDAta=ref([])
loginApi().then(res=>
{
    
    console.log('登入数据',res);
    DengRuDAta.values=res.data.data
    if(res.data.code==1)
    {
        console.log('登入成功');
        // let token=.location.setItem('token',data.token )
        // router.push('/home ')
    }
})
</script>

<style lang="scss" scoped></style>